﻿using EvaluationSystem.Dto;
using EvaluationSystem.Models;

namespace EvaluationSystem.ViewModels;

public class CommentVm
{
    public CommentVm(Comment comment)
    {
        this.cid = comment.CommentId;
        this.pid = comment.PublisherId;
        this.pname = comment.Publisher?.Name;
        this.ptype = comment.Publisher?.Career == Identity.STUDENT ? "学生" : "教师";
        this.rid = comment.ReplierId;
        this.rname = comment.Replier?.Name;
        this.rtype = comment.Replier?.Career == Identity.STUDENT ? "学生" : "教师";
        this.content = comment.Content;
        this.cdate = comment.CreatedAt;
    }

    public int cid { get; set; }
    public int? pid { get; set; }
    public string? pname { get; set; }
    public string? ptype { get; set; }
    public int? rid { get; set; }
    public string? rname { get; set; }
    public string? rtype { get; set; }
    public string content { get; set; }
    public DateTime cdate { get; set; }
}